$ () ->
	LoginFunction = () ->
		_tempRemember = 0

		if $("#remember").prop('checked')
			_tempRemember = 1

		param =
			username: $("#username").val()
			password: $("#password").val()
			remember: _tempRemember

		$.post "/api/admin/login",param, (res) ->
			if res.status.errCode is 0
				# window.location.href = '/admin/desktop/index'
				alert "success"
			else
				alert res.status.message

	$('#submit_btn').click (e) ->
		LoginFunction()

	$(document).keyup (e) ->
		if e.which is 13
			LoginFunction()